package com.itheima.mycollection;

import java.util.ArrayList;
import java.util.Iterator;

public class Demo3 {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();

        list.add("仓井红");
        list.add("仓井绿");
        list.add("仓井蓝");
        list.add("仓井蓝");

        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()){
            String s = iterator.next();
            if ("仓井蓝".equals(s)){
                iterator.remove();
            }
        }
        System.out.println(list);
    }
}
